import { defHttp } from '../http'
import type { CommonAPI } from '../schema/all'
/**
 * @description: 证书
 */

/** 创建ACME账户 */
export const addApiAcmeAccountApi: CommonAPI<'/api/acme-account', 'post'> = (
  data
) => defHttp.post(`/api/acme-account`, { data })

/** 删除ACME账户 */
export const deleteApiAcmeAccountApi: CommonAPI<
  '/api/acme-account',
  'delete'
> = (data) => defHttp.delete(`/api/acme-account`, { data })

/** 查询ACME账户 */
export const getApiAcmeAccountQueryApi: CommonAPI<
  '/api/acme-account/query',
  'get'
> = (params) => defHttp.get(`/api/acme-account/query`, { params })

/** 获取证书 */
export const getApiCertApi: CommonAPI<'/api/cert', 'get'> = (params) =>
  defHttp.get(`/api/cert`, { params })

/** 获取申请日志证书日志 */
export const getApiCertApplyLogApi: CommonAPI<'/api/cert/apply-log', 'get'> = (
  params
) =>
  defHttp.get(`/api/cert/apply-log`, { params }, { isTransformResponse: false })

/** 查询CNAME */
export const getApiCertLookupCnameApi: CommonAPI<
  '/api/cert/lookup-cname',
  'get'
> = (params) => defHttp.get(`/api/cert/lookup-cname`, { params })

/** 申请证书 */
export const postApiCertObtainApi: CommonAPI<'/api/cert/obtain', 'post'> = (
  data
) => defHttp.post(`/api/cert/obtain`, { data })

/** 查询证书 */
export const getApiCertQueryApi: CommonAPI<'/api/cert/query', 'get'> = (
  params
) => defHttp.get(`/api/cert/query`, { params })

/** 上传证书 */
export const postApiCertUploadApi: CommonAPI<'/api/cert/upload', 'post'> = (
  data
) => defHttp.post(`/api/cert/upload`, { data })

/** 获取站点证书 */
export const getApiSiteCertApi: CommonAPI<'/api/site/cert', 'get'> = (params) =>
  defHttp.get(`/api/site/cert`, { params })

/** 更新站点证书 */
export const updateApiSiteCertApi: CommonAPI<'/api/site/cert', 'put'> = (
  data
) => defHttp.put(`/api/site/cert`, { data })
